<?php
use yii\helpers\Html;
use yii\helpers\Url;
use yii\widgets\ActiveForm;
use common\models\MktPost;
use common\models\MktUser;
use common\wosotech\Util;
?>
<!--
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="keywords" content="首页关键字" />
  <meta name="description" content="首页描述" />
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Cache-Control" content="no-cache" />
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=2.0" />
  <meta name="apple-mobile-web-app-capable" content="yes"/>
  
  <link rel="stylesheet" href="resources/css/weui/weui.min.css">
  <link rel="stylesheet" href="resources/css/main.min.css">
  <link rel="stylesheet" href="resources/css/man.min.css">
  
  <script src="resources/js/jquery-1.10.min.js"></script>
  <script src="resources/js/jquery.touchSwipe.min.js"></script>
  <script src="resources/js/frmwebm.min.js"></script>
  <title>张倩</title>
  <style>
  .weui_cell::before {
    border-top: 0px;
  }
  .weui_grid::before {
    border-right: 0px;
  }
  .weui_grid{
    width: 50%;
	padding: 0px 0px 5px 0px;
  }
  .weui_grid_label_left{
	text-align: left;
  }
  .weui_grid_label_right{
	text-align: right;
  }
  .weui_label{
    left:100px;
	width: 40px;
	color:#999999;
  }
  .weui_grid_icon{
	width: auto;
	line-height: 45px;
  }
  .weui_grid_icon_left{
	  padding-left: 24px;
  }
  .weui_grid_icon_right{
	padding-right: 18px;
	text-align: right;
  }
  .weui_cell{
	padding-left: 15vw;
	padding-right: 15vw;
	height:22px;
  }
  .weui_cells{
	margin-top: 10px;
  }
  .weui_cells:before {
    border-top: 0px;
  }
  .weui_cell_label_left{
	text-align: left;
  }
  .weui_cell_label_right{
	text-align: right;
	font-size:15px;
  }
  .weui_cells:after {
    border-bottom: 0px;
  }
  .weui_grid_label {
    font-size: 15px;
  }
  </style>
</head>
<body style="color:#353535">
-->
<?php $this->params['bodyStyle'] = "color:#353535"; ?>
<?php $this->title = $model->theName; ?>
  <style>
  .weui_cell::before {
    border-top: 0px;
  }
  .weui_grid::before {
    border-right: 0px;
  }
  .weui_grid{
    width: 50%;
	padding: 0px 0px 5px 0px;
  }
  .weui_grid_label_left{
	text-align: left;
  }
  .weui_grid_label_right{
	text-align: right;
  }
  .weui_label{
    left:100px;
	width: 40px;
	color:#999999;
  }
  .weui_grid_icon{
	width: auto;
	line-height: 45px;
  }
  .weui_grid_icon_left{
	  padding-left: 24px;
  }
  .weui_grid_icon_right{
	padding-right: 18px;
	text-align: right;
  }
  .weui_cell{
	padding-left: 15vw;
	padding-right: 15vw;
	height:22px;
  }
  .weui_cells{
	margin-top: 10px;
  }
  .weui_cells:before {
    border-top: 0px;
  }
  .weui_cell_label_left{
	text-align: left;
  }
  .weui_cell_label_right{
	text-align: right;
	font-size:15px;
  }
  .weui_cells:after {
    border-bottom: 0px;
  }
  .weui_grid_label {
    font-size: 15px;
  }
  </style>

	<div class="pepole_top pepole_<?php echo $model->isWoman() ? 'woman' : 'man'; ?>">

		<?php if ($model->isWoman()): ?>
			<div class="left_btn_bg">
				<img src="resources/images/market/woman/u183.png">
			</div>
			<div onclick="toggleFollow(this)" class="left_btn">
				<img src="resources/images/market/<?php echo $me->isMyFollow($model->id) ? 'u278.png' : 'u251.png'; ?>" class=" <?php echo $me->isMyFollow($model->id) ? 'left_btn_bg_star' : ''; ?>">
			</div>

			<div class="right_btn_bg">
				<img src="resources/images/market/woman/u183.png">
			</div>
			<div onclick="addFriend()" class="right_btn">
				<img src="resources/images/market/u253.png">
			</div>

			<div class="avatar_bg">
				<img src="resources/images/market/woman/u185.png">
			</div>
			<div class="avatar">
				<img src="<?php echo Util::getWxUserHeadimgurl($model->headimgurl, 0); ?> ">
			</div>

		<?php else: ?>
			<div class="left_btn_bg">
				<img src="resources/images/market/man/u569.png">
			</div>

			<div onclick="toggleFollow(this)" class="left_btn">
				<img src="resources/images/market/<?php echo $me->isMyFollow($model->id) ? 'u278.png' : 'u251.png'; ?>" class=" <?php echo $me->isMyFollow($model->id) ? 'left_btn_bg_star' : ''; ?>">
			</div>

			<div class="right_btn_bg">
				<img src="resources/images/market/man/u569.png">
			</div>
			<div onclick="addFriend()" class="right_btn">
				<img src="resources/images/market/u253.png">
			</div>

			<div class="avatar_bg">
				<img src="resources/images/market/woman/u185.png">
			</div>
			<div class="avatar">
				<img src="<?php echo Util::getWxUserHeadimgurl($model->headimgurl, 0); ?> ">
			</div>

		<?php endif; ?>

		<div class="post_div">
			<div style="width: 50%; height: 120px;float: left;">
				<div class="post_up">
					<p><span><?php echo $model->theDuty; ?></span></p>
				</div>
				<div class="post_down">
					<p><span><?php echo empty($model->area) ? '' : $model->area->getPaths(); ?></span></p>
				</div>
			</div>
			<div style="width: 50%; height: 120px;float: left;">
				<div class="post_up">
					<p><span><!--幼教--><?php echo $model->industry->root->theTitle; ?></span></p>
				</div>
				<div class="post_down">
					<p><span><!--教育培训--><?php echo $model->industry->theTitle; ?></span></p>
				</div>
			</div>
		</div>
		
		<div class="baseInfo_div">
			<div class="name">
				<p><?php echo $model->theName; ?></p>
			</div>
			<div class="mark">
				<p><span><?php echo \common\wosotech\Util::getShortString($model->company, 10); ?></span></p>
			</div>
		</div>
	</div>
	
	<div class="weui_grids">
        <div onclick="gotoManLib()" class="weui_grid" style="padding-left: 15vw;">
            <div class="weui_grid_icon weui_grid_icon_left"><span style="color:red;"><?php echo $model->sourceCount; ?></span></div>
            <p class="weui_grid_label weui_grid_label_left">可供资源</p>
        </div>
        <div onclick="gotoManWork()" class="weui_grid" style="padding-right: 15vw;">
            <div class="weui_grid_icon weui_grid_icon_right"><span style="color:red;"><?php echo $model->postCount; ?></span></div>
            <p class="weui_grid_label weui_grid_label_right">工作圈</p>
        </div>
    </div>
	
	<div style="width:100%;height:20px;background: #EBEBEB;"></div>
	<div class="weui_cells">
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">手机:</label>
			</div>
			<div class="weui_cell_bd weui_cell_primary weui_cell_label_right"><?php echo $model->getScreenMobile($me); ?></div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">&nbsp;QQ&nbsp;:</label>
			</div>
    		<div class="weui_cell_bd weui_cell_primary weui_cell_label_right"><?php echo $model->getScreenQq($me); ?></div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">微信:</label>
			</div>
    		<div class="weui_cell_bd weui_cell_primary weui_cell_label_right"><?php echo $model->getScreenWeixin($me); ?></div>
		</div>
		<div class="weui_cell">
			<div class="weui_cell_hd">
				<label class="weui_label">邮箱:</label>
			</div>
    		<div class="weui_cell_bd weui_cell_primary weui_cell_label_right"><?php echo $model->getScreenEmail($me); ?></div>
		</div>
		
		<div class="weui_opr_area">
			<p class="weui_btn_area">
				<a href="javascript:addFriend()" class="weui_btn weui_btn_warn">加好友</a>
			</p>
		</div>
	</div>
<script type="text/javascript">

function gotoManLib()
{
	//window.location.href="list.jsp";
    window.location.href="<?php echo Url::to(['wap/market-list', 'id' => $model->id]); ?>";
}

function gotoManWork()
{
	//window.location.href="work.jsp";
    window.location.href="<?php echo Url::to(['wap/market-work', 'id' => $model->id]); ?>";
}

function clickStar(self)
{
	var img = $(self).find("img");
	if(img.hasClass("left_btn_bg_star"))
	{

		img.removeClass("left_btn_bg_star");
		img.attr("src", "resources/images/market/u251.png")
	}
	else
	{
		img.addClass("left_btn_bg_star");
		img.attr("src", "resources/images/market/u278.png")
	}
}

/*
function checkUserInfo() {
    var jumpUrl = "<?php echo $this->context->getMe()->getJump() ?>";
    if (jumpUrl.length)
    {
        window.location.href = jumpUrl;
        return false;
    }
    return true;
}
*/

function toggleFollow(self) {

    //if (!checkUserInfo()) return false;

    var jumpUrl = "<?php echo $this->context->getMe()->getJump() ?>";
    if (jumpUrl.length)
    {
        window.location.href = jumpUrl;
        return false;
    }

    if ("<?php echo $this->context->getMe()->id ?>" == "<?php echo $model->id ?>")
    {
        frmwebm.prompt({
            title: "友情提示",
            content: '不能自己关注自己！'
        });
        return;
    }

	var args = {
		'classname': '\\common\\models\\MktUser',
		'funcname': 'toggleFollowAjax',
		'params': {
			'user_id' : <?php echo \common\wosotech\Util::getSessionUserId(); ?>,
			'follow_id': <?php echo $model->id; ?>
		}
	};

	$.ajax({
		url: "<?= Url::to(['/wap/ajax-broker']); ?>",
		type: "GET",
		cache: false,
		dataType: "json",
		data: "args=" + JSON.stringify(args),
		success: function (resp) {
			if (resp['code'] != 0) {
				alert("handle error");
				return;
			}
			clickStar(self);
		},
		error: function () {
			//alert('send error');
		}
	});
}

function addFriend() {
    var jumpUrl = "<?php echo $this->context->getMe()->getJump() ?>";
    if (jumpUrl.length)
    {
        window.location.href = jumpUrl;
        return false;
    }

    if ("<?php echo $this->context->getMe()->id ?>" == "<?php echo $model->id ?>")
    {
        frmwebm.prompt({
            title: "友情提示",
            content: '不能自己加自己为好友！',
            afterClose: "<?= Url::to(['/wap/market-home', 'page'=>1]); ?>"
        });
        return;
    }

	var args = {
		'classname': '\\common\\models\\MktUser',
		'funcname': 'addFriendAjax',
		'params': {
			'user_id' : <?php echo \common\wosotech\Util::getSessionUserId(); ?>,
			'friend_id': <?php echo $model->id; ?>
		}
	};

	frmwebm.confirm({
		title:"加好友",
		content:"将消耗10积分<br>72小时内，对方如果没有反应，10积分将返回您的账户。",
		url: "<?= Url::to(['/wap/ajax-broker']); ?>",
		type: "GET",
		data: "args=" + JSON.stringify(args),
		successFunc: function (resp) {
			if (resp['code'] != 0) {
				frmwebm.prompt({
					title: "友情提示",
					content: resp['data']
				});
				return;
			}
			frmwebm.prompt({
				title: "成功发送好友申请",
				content: "已冻结10个金币...",
				reload: true
			});
		},
		errorFunc: function () {
			//alert('send error');
		},
		//reload: true
		//afterClose: null,
	});

}

</script>


<!--
</body>
</html>
-->

<?php /*
 <!--
			<div class="left_btn_bg">
				<img src="resources/images/market/man/u569.png">
			</div>

			<div onclick="clickStar(this)" class="left_btn">
				<img src="resources/images/market/u251.png">
			</div>
-->

<!--
			<div class="<?php echo $me->isMyFollow($model->id) ? 'left_btn_bg_star' : 'left_btn_bg'; ?>">
				<img src="resources/images/market/man/u569.png">
			</div>

			<div onclick="clickStar(this)" class="left_btn">
				<img src="resources/images/market/<?php echo $me->isMyFollow($model->id) ? 'u278.png' : 'u251.png'; ?>">
			</div>
-->

 */